# Contributor: Marvin Preuss <marvin@xsteadfastx.org>
# Maintainer: Marvin Preuss <marvin@xsteadfastx.org>
pkgname=rofi
pkgver=1.7.3
pkgrel=0
_libnkutils=d08fa898d71da4c11653284968ec14384dd70b6a
_libgwater=555fa6df92434c1c3c7548b5a583b1d8ec3fabb3
pkgdesc="Window switcher, application launcher and dmenu replacement"
url="https://github.com/DaveDavenport/rofi"
arch="all !s390x !riscv64" # limited by librsvg -> rust
license="MIT"
depends="$pkgname-themes>=$pkgver"
makedepends="
	meson
	glib-dev
	cairo-dev
	pango-dev
	libxkbcommon-dev
	libxcb-dev
	gdk-pixbuf-dev
	xcb-util-dev
	xcb-util-wm-dev
	xcb-util-xrm-dev
	xcb-util-cursor-dev
	startup-notification-dev
	flex
	bison
	ronn
	"
checkdepends="cppcheck check-dev xkeyboard-config-dev"
provider_priority=100  # highest (other provider is rofi-wayland aport)
subpackages="$pkgname-dev $pkgname-doc $pkgname-themes::noarch"
source="https://github.com/davatorium/rofi/releases/download/$pkgver/rofi-$pkgver.tar.gz
	libnkutils-$_libnkutils.tar.gz::https://github.com/sardemff7/libnkutils/archive/$_libnkutils.tar.gz
	libgwater-$_libgwater.tar.gz::https://github.com/sardemff7/libgwater/archive/$_libgwater.tar.gz
	scrollbar-test.patch
	rofi-sensible-terminal-use-sh.patch
	"

prepare() {
	default_prepare

	rm -rf subprojects/libnkutils subprojects/libgwater
	mv "$srcdir"/libnkutils-$_libnkutils subprojects/libnkutils
	mv "$srcdir"/libgwater-$_libgwater subprojects/libgwater
}

build() {
	abuild-meson . output
	meson compile ${JOBS:+-j ${JOBS}} -C output
}

check() {
	meson test --no-rebuild -v -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output

	# This image makes 2/3 of the size of the themes directory.
	# It's not the default theme, so get rid of it.
	rm -rf "$pkgdir"/usr/share/rofi/themes/iggy.jpg
}

themes() {
	pkgdesc="$pkgdesc (themes)"
	depends=""
	replaces="$pkgname rofi-wayland"  # for backward compatibility

	amove usr/share/rofi/themes
}

sha512sums="
5d1b8fed868a7fcf372298800997d4aeeb9b428858448a9b9e4c523af8d878aa172dc63ad788cdc950af89a1f3ea850bc4c98a55c9e8ace29e67050ac0c02078  rofi-1.7.3.tar.gz
ed5fca928929e9af09bf1889f8012b6c31d7a3fc780680e15c577152c79ec8df395a798b33816c07f6ccd5ea6938b88a69f8357612de944c1ff2a4f50b98f34d  libnkutils-d08fa898d71da4c11653284968ec14384dd70b6a.tar.gz
1d9307167fa18c2d7249ae1df33286f646ade3d28c0aa22307d0d7d379c281a7e866a3e7f23da039bfccbe01e13e4d8f49929cac6a9e5df51d368ae3f9088588  libgwater-555fa6df92434c1c3c7548b5a583b1d8ec3fabb3.tar.gz
772e58ff3d617c2ef8e70919fa099fbf24d2c7a5d91ad3d459d162e62c35ee786a646e2475f52cb1a55ee51387862e952e65f2a166d0b692db69d8c1306da836  scrollbar-test.patch
13a93621337b4f317031da9007ed9d426b055190fc946a87eb12333469f9a23e85763e2c1e0492ff2d1d50ceebd429d8125a0b275d1ab0573a4d10cd812bccd9  rofi-sensible-terminal-use-sh.patch
"
